home *** CD-ROM | disk | FTP | other *** search
/ SGI Hot Mix 17 / Hot Mix 17.iso / HM17_SGI / research / examples / object / test_surface.pro < prev    next >
Text File  |  1997-07-08  |  1KB  |  46 lines

  1. ;---------------------------------------------------------------
  2. ; This procedure file defines the procedure test_surface, which
  3. ; is used as an example in Chapter 5 of _Objects and Object
  4. ; Graphics_.
  5. ;---------------------------------------------------------------
  6.  
  7. PRO test_surface, VIEW=oView, MODEL=oModel, SURFACE=oSurface, WINDOW=oWindow
  8.  
  9.     ; Create some data.
  10.     zData = DIST(60)
  11.  
  12.     ; Create a view.
  13.     oView = OBJ_NEW('IDLgrView', color=[60,60,60], VIEWPLANE_RECT=[-1,-1,2,2])
  14.  
  15.     ; Create a model.
  16.     oModel = OBJ_NEW('IDLgrModel' )
  17.     oView->Add, oModel
  18.  
  19.     ; Create a surface.
  20.     oSurface = OBJ_NEW('IDLgrSurface', zData, color=[255,0,0])
  21.  
  22.     ; Add the surface to the model.
  23.     oModel->Add, oSurface
  24.  
  25.     ; Get the data range of the surface.
  26.     oSurface->GetProperty,XRANGE=xrange,YRANGE=yrange,ZRANGE=zrange
  27.  
  28.     ; Scale surface to normalized units and center.
  29.     xs = [-0.5, 1/(xrange[1]-xrange[0])]
  30.     ys = [-0.5, 1/(yrange[1]-yrange[0])]
  31.     zs = [-0.5, 1/(zrange[1]-zrange[0])]
  32.     oSurface->SetProperty,XCOORD_CONV=xs, YCOORD_CONV=ys, ZCOORD_CONV=zs
  33.  
  34.     ; Rotate model to standard view.
  35.     oModel->Rotate,[1,0,0], -90
  36.     oModel->Rotate,[0,1,0], 30
  37.     oModel->Rotate,[1,0,0], 30
  38.  
  39.     ; Create a window destination.
  40.     oWindow = OBJ_NEW('IDLgrWindow')
  41.  
  42.     ; Draw the view.
  43.     oWindow->Draw, oView
  44.  
  45. END
  46.